package com.android.job.ui.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.android.job.model.ResumeItem;
import com.android.job.ui.R;

/**
 * 简历查询结果列表的Adapter
 * 
 * @author yyl
 * 
 */
public class ResumeItemAdapter extends BaseAdapter
{

	private Context mContext;
	private List<ResumeItem> resumeList;
	private ViewHolder holder;
	
	
	public ResumeItemAdapter(Context mContext, List<ResumeItem> resumeList)
	{
		this.mContext = mContext;
		this.resumeList = resumeList;
	}

	@Override
	public int getCount()
	{
		return resumeList.size();
	}

	@Override
	public Object getItem(int position)
	{
		return position;
	}

	@Override
	public long getItemId(int position)
	{
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent)
	{
		if (convertView == null)
		{
			holder = new ViewHolder();
			convertView = LayoutInflater.from(mContext).inflate(
					R.layout.resume_item, null);
			holder.realName = (TextView) convertView
					.findViewById(R.id.real_name_tv_id);
			holder.gender = (TextView) convertView
					.findViewById(R.id.gender_tv_id);
			holder.degree = (TextView) convertView
			.findViewById(R.id.degree_tv_id);
			holder.salary = (TextView) convertView
			.findViewById(R.id.salary_tv_id);
			convertView.setTag(holder);
		}
		else
		{
			holder = (ViewHolder) convertView.getTag();
		}
		
		holder.realName.setText(resumeList.get(position).realName);
		holder.gender.setText(resumeList.get(position).gender);
		holder.degree.setText(resumeList.get(position).degree);
		holder.salary.setText(resumeList.get(position).salary);
		
		return convertView;
	}
	
	
	private class ViewHolder
	{

		private TextView realName;
		// 真实姓名
		private TextView gender;
		// 性别
		private TextView degree;
		//学历
		private TextView salary;
	}

}
